const ejs = require('ejs')
const bijimodle = require('./model/bijimodle')
const express = require('express')
const {resolve} = require('path')
const session = require('express-session')
const app = express()
const pagerouter = require('./routes/pagerouter')
const apirouter = require('./routes/apirouter')
const cors = require('cors')
app.set('views',__dirname+'/html')
app.engine('html',ejs.renderFile)
app.listen(80,()=>{
    console.log('80端口启动成功!');
})
app.use(cors())
app.use(express.static(resolve(__dirname,'./public')))
app.use(express.urlencoded({extended:false}))
app.use(session({
    name: 'sids',
    secret: 'admin',
    saveUninitialized: true,
    resave: true,
    cookie: {
        httpOnly: true,
        maxAge: 1000 * 60 * 60
    }
}))
app.use(pagerouter)
app.use(apirouter)
